package cc.qiblogs.news.ui.model;

import java.util.List;

import cc.qiblogs.news.api.Api;
import cc.qiblogs.news.app.AppConfig;
import cc.qiblogs.news.bean.Data;
import cc.qiblogs.news.common.baserx.RxSchedulers;
import cc.qiblogs.news.ui.contract.NewsContract;
import rx.Observable;

/**
 * Created by qihuang on 16-11-5.
 */

public class NewsModel implements NewsContract.Model {
    @Override
    public Observable<List<Data>> getChannelList(String type) {
        return Api.getDefault()
                .getNews(type, AppConfig.apiKey)
                .map(news -> news.getResult().getData())
                .compose(RxSchedulers.io_main());
    }
}
